<?php
/*
 * Created on 2012-10-31
 *
 * To change the template for this generated file go to
 * Window - Preferences - PHPeclipse - PHP - Code Templates
 */
 
class UtilsResponder
{
	/*
	 * 显示业务逻辑错误
	 */
	public static function getError($errorCode,$errorMsg='')
	{
		$str = array('errorCode'=>$errorCode,'errorMsg'=>$errorMsg);
		return CJSON::encode($str);
	}
        
        /*
         * 直接输出业务逻辑错误
         * 
         */
        public static function showError($errorCode,$errorMsg='')
        {
            echo UtilsResponder::getError($errorCode,$errorMsg);
        }
	
	/*
	 * 显示业务正常返回
	 */
	public static function getSuccess($content)
	{
		$str = array('content'=>$content,'userId'=>Yii::app()->user->id);
		return CJSON::encode($str);		
	}
	/*
	 * 输出业务成功执行
	 */
	public static function showSuccess($content)
	{
            echo UtilsResponder::getSuccess($content);
	}	
	
}
